import request from '@/utils/request'

// 查询列表
export function listOrder(query) {
  return request({
    url: '/credit/order/list',
    method: 'post',
    data: query
  })
}

// 获取登录者的订单
export function userOrderList(query) {
  return request({
    url: '/credit/order/userOrderList',
    method: 'post',
    data: query
  })
}

// 查询【请填写功能名称】详细
export function getOrder(orderId) {
  return request({
    url: '/credit/order/' + orderId,
    method: 'get'
  })
}

// 查询单个order实体通过orderId
export function getOrderNew(data) {
  return request({
    url: '/credit/order/byOrderId',
    method: 'post',
    data: data
  })
}

// 新增
export function addOrder(data) {
  return request({
    url: '/credit/order',
    method: 'post',
    data: data
  })
}

// 修改
export function updateOrder(data) {
  return request({
    url: '/credit/order',
    method: 'put',
    data: data
  })
}

// 删除
export function delOrder(orderId) {
  return request({
    url: '/credit/order/' + orderId,
    method: 'delete'
  })
}

// 合同生成及发送
export function addContract(data) {
  return request({
    url: '/credit/contract/addContract',
    method: 'post',
    data: data
  })
}

// 获取单次还款表信息
export function getRefundById(orderId) {
  return request({
    url: '/credit/order/getRefund/' + orderId,
    method: 'get'
  })
}

// 获取一次性次还款表信息
export function getDisRefundById(orderId) {
  return request({
    url: '/credit/order/getDisRefundById/' + orderId,
    method: 'get'
  })
}

//发送消息
export function sendTest(to,subject,text){
  return request({
    url:'/credit/order/sendText'+ to + subject + text,
    method:'get'
  })
}